package com.itheima.service.impl;

import com.itheima.dao.UserDao;
import com.itheima.dao.impl.UserDaoImpl;
import com.itheima.domain.User;
import com.itheima.service.UserService;

import java.util.List;

public class UserServiceImpl implements UserService {
    @Override
    public List<User> findAll() {
        UserDao dao = new UserDaoImpl();
        return dao.findAll();
    }

    @Override
    public void save(User user) {
        UserDao dao = new UserDaoImpl();
        dao.save(user);
    }

    @Override
    public void deleteById(String id) {
        UserDao dao = new UserDaoImpl();
        dao.deleteById(id);
    }

    @Override
    public void update(User user) {
        UserDao dao = new UserDaoImpl();
        dao.update(user);
    }

    @Override
    public User findById(String id) {
        UserDao dao = new UserDaoImpl();
        return dao.findById(id);
    }
}
